package com.caac.core.service.impl;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import com.caac.core.config.Config;
import com.caac.core.config.OrderClazz;
import com.caac.core.config.QueryClass;
import com.caac.core.dao.BaseDao;
import com.caac.core.dao.CriteriaCallback;
import com.caac.core.service.BaseManager;
import com.caac.core.util.Page;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright caac 2006</p>
 * <p>Company: caac</p>
 * @author <a href="mailto:project@caac.com.cn">Project Group</a>
 * @version 1.0
 */

public class BaseManagerImpl implements BaseManager {
    protected final Log log = LogFactory.getLog(getClass());
    protected BaseDao baseDao;

    public void setBaseDao(BaseDao baseDao) {
        this.baseDao = baseDao;
    }

    public Object getObjectById(Class entityClass, Serializable id) {
        return baseDao.getObjectById(entityClass, id);
    }

    public Object loadObjectById(Class entityClass, Serializable id) {
        return baseDao.loadObjectById(entityClass, id);
    }

    public List getAllObjects(Class entityClass) {
        return baseDao.getAllObjects(entityClass);
    }

    public void saveObject(Object entity) {
        baseDao.saveObject(entity);
    }

    public void newObject(Object entity) {
        baseDao.newObject(entity);
    }

    public void deleteObject(Object entity) {
        baseDao.deleteObject(entity);
    }

    public void deleteObjectById(Class entityClass, Serializable id) {
        baseDao.deleteObjectById(entityClass, id);
    }

    public void deleteAllObjects(Collection entities) {
        baseDao.deleteAllObjects(entities);
    }

    public List getObjects(final Class clazz, final QueryClass qc,
                           final Object bean, final boolean and,
                           final OrderClazz oc, final CriteriaCallback cc,
                           final Page page) {
        return baseDao.getObjects(clazz, qc, bean, and, oc, cc, page.getRowFrom(),
                                  page.getPageSize());
    }

    public List getObjects(final Class clazz, final QueryClass qc,
                           final Object bean, final boolean and,
                           final OrderClazz oc, final Page page) {
        return baseDao.getObjects(clazz, qc, bean, and, oc, page.getRowFrom(),
                                  page.getPageSize());
    }

    public List getObjects(final Class clazz, final QueryClass qc,
                           final Object bean, final boolean and,
                           final CriteriaCallback cc, final Page page) {
        return baseDao.getObjects(clazz, qc, bean, and, cc, page.getRowFrom(),
                                  page.getPageSize());
    }

    public List getObjects(final Class clazz, final QueryClass qc,
                           final Object bean, final boolean and,
                           final Page page) {
        return baseDao.getObjects(clazz, qc, bean, and, page.getRowFrom(),
                                  page.getPageSize());
    }

    public List getObjects(final Class clazz, final QueryClass qc,
                           final Object bean, final boolean and,
                           final OrderClazz oc, final CriteriaCallback cc) {
        return baseDao.getObjects(clazz, qc, bean, and, oc, cc);
    }

    public List getObjects(final Class clazz, final QueryClass qc,
                           final Object bean, final boolean and,
                           final OrderClazz oc) {
        return baseDao.getObjects(clazz, qc, bean, and, oc);
    }

    public List getObjects(final Class clazz, final QueryClass qc,
                           final Object bean, final boolean and,
                           final CriteriaCallback cc) {
        return baseDao.getObjects(clazz, qc, bean, and, cc);
    }

    public List getObjects(final Class clazz, final QueryClass qc,
                           final Object bean, final boolean and) {
        return baseDao.getObjects(clazz, qc, bean, and);
    }

    public List getObjects(final Class clazz, final String whereString,
                           final OrderClazz oc, final Page page) {
        return baseDao.getObjects(clazz, whereString, oc, page.getRowFrom(),
                                  page.getPageSize());
    }

    public List getObjects(final Class clazz, final String whereString,
                           final OrderClazz oc) {
        return baseDao.getObjects(clazz, whereString, oc);
    }

    public List getObjects(final Class clazz, final String sql, final int count) {
        return baseDao.getObjects(clazz, sql, count);
    }

    public List getObjects(final Class clazz, final String whereString,
                           final Page page) {
        return baseDao.getObjects(clazz, whereString, page.getRowFrom(),
                                  page.getPageSize());
    }

    public List getObjects(final Class clazz, final String whereString) {
        return baseDao.getObjects(clazz, whereString);
    }

    public int getCount(final Class clazz, final QueryClass qc,
                        final Object bean, final boolean and,
                        final CriteriaCallback cc) {
        return baseDao.getCount(clazz, qc, bean, and, cc);
    }

    public int getCount(final Class clazz, final QueryClass qc,
                        final Object bean, final boolean and) {
        return baseDao.getCount(clazz, qc, bean, and);
    }

    public int getCount(final Class clazz, final String whereString) {
        return baseDao.getCount(clazz, whereString);
    }

    public int getAllCount(final Class clazz) {
        return baseDao.getAllCount(clazz);
    }

    public List getAllObjects(final Class clazz, final OrderClazz oc) {
        return baseDao.getAllObjects(clazz, oc);
    }

    public Config getConfig() {
        return Config.getInstance();
    }

    public void execNoResultProc(String strSql) {
        baseDao.execNoResultProc(strSql);
    }

    public void execNoResultSql(String strSql) {
        baseDao.execNoResultSql(strSql);
    }

    public List execSqlWithResult(String strSql) {
        return baseDao.execSqlWithResult(strSql);
    }

    public Object getArray(List rstList, int row, int col) {
        return baseDao.getArray(rstList, row, col);
    }
}
